var c = document.getElementById("graphCanvas");
var g = new Graph.SpringGraph(c);

var edges = [
	["Abilities", "Strength"],
	["Abilities", "Dexterity"],
	["Abilities", "Constitution"],
	["Abilities", "Intelligence"],
	["Abilities", "Wisdom"],
	["Abilities", "Charisma"],

	["Abilities", "KOM"],
	["Abilities", "KDM"],

	["Strength", "Str Modifier"],
	["Dexterity", "Dex Modifier"],
	["Constitution", "Con Modifier"],
	["Intelligence", "Int Modifier"],
	["Wisdom", "Wis Modifier"],
	["Charisma", "Cha Modifier"],

	["Constitution", "Hold Breath"],

	["Str Modifier", "Fortitude"],
	["Str Modifier", "Athletics"],
	["Str Modifier", "Athletics"],

	["Dex Modifier", "Initiative"],
	["Dex Modifier", "Reflex"],
	["Dex Modifier", "Acrobatics"],

	["Con Modifier", "HP"],
	["Con Modifier", "Fortitude"],

	["Int Modifier", "Languages"],
	["Int Modifier", "Reflex"],

	["Wis Modifier", "Will"],
	["Wis Modifier", "Perception"],
	["Wis Modifier", "Awareness"],

	["Cha Modifier", "Will"],

	["Athletics", "Climbing"],
	["Athletics", "Swimming"],
	["Athletics", "Base Ground Speed"],
	["Athletics", "Flight Speed"],
	["Athletics", "Teleportation Speed"],
	["Athletics", "Hold Breath"],

	["Acrobatics", "Avoid AoO"],
	["Acrobatics", "Surprise Opponent"],
	["Acrobatics", "Balancing"],
	["Acrobatics", "Jumping"],

	["BAB", "AC"],
	["KDM", "AC"],

	["Level", "BAB"],
	["Level", "HP"],
	["Level", "Awareness"],

	["Awareness Bonus", "Awareness"],
	["Awareness Bonus", "Geography"],
	["Awareness Bonus", "Larceny"],
	["Awareness Bonus", "Nature"],
	["Awareness Bonus", "Perception"]
];

for (var i = 0; i < edges.length; i+=1)
{
	g.addEdge(edges[i][0], edges[i][1]);
}
var interval = 50; // milliseconds between updates
var iterations = 200; // total number of iterations
var killLoop;

var layoutLoop =  function ()
{
	var t = new Date().valueOf() + 35;
	while (t > new Date().valueOf())
	{
		g.step();
	}
	g.draw();
	killLoop = setTimeout(layoutLoop, 15);
};
g.draw();
layoutLoop();
setTimeout("window.clearInterval(killLoop);", interval * iterations);